*---------------------------------------------------------------------------------------------------*
Create Facies Boundaries
Author: Gavin Henry Graham
Date: 11/01/2014

This is a research code and it is hoped that it will be useful. However, the author does not accept 
any responsibility to anyone for the consequences of using the code.
*---------------------------------------------------------------------------------------------------*

Copyright Declaration

The copyright of the code "Create Facies Boundaries" rests with the author and is made available 
under a Creative Commons Attribution Non-Commercial No Derivatives licence. Researchers are free 
to copy, distribute or transmit the code on the condition that they attribute it, that they do not 
use it for commercial purposes and that they do not alter, transform or build upon it. For any reuse 
or redistribution, researchers must make clear to others the licence terms of this work.

*---------------------------------------------------------------------------------------------------*

Code Description

Takes facies boundary surfaces from a non-clinoform bearing model and clinoform surfaces generated with 
the clinoform modelling algorithm, and uses these to create facies boundary surfaces within each 
clinothem. This creates discrete zones of constant facies type bounded by surfaces within each 
clinothem. The facies boundary surfaces are required for gridding and assigning petrophysical properties 
in order to be consistent with a surface-based reservoir modelling workflow (see Jackson et al., 
2014). 

Inputs: 
	1. Press 1 if surfaces have positive depths in the subsurface (e.g. ROxar's RMS) and press
           2 if surfaces have negative depths in the subsurface (e.g. Petrel)
	
	2. The number of facies boundary surfaces
	
	3. Surfaces that represent the boundary between facies type in zmap+ format (must have the same
	   number of nodes in the x- and y-directions as the clinoform surfaces generated by the 
	   clinoform-modelling algorithm)
	   (e.g. C:\Users\Imperial\Desktop\SMB.zmap+ see example inputs)

	4. The number of clinoform surfaces	
	
	5. Unmodified clinoform surfaces that have been generated by the clinoform modelling algorithm
	
	6. The file path where the clinoform surfaces can be found
	   (e.g. C:\Users\Imperial\Desktop\ )

Outputs:

	1. Facies boundary surfaces between each clinoform pair (e.g. red surfaces in Fig. 2.8C, D) in
	   zmap+ file format. These can be used along with the clinoform surfaces and bounding surfaces 
	   for gridding a wholly surface-based model as shown in Figs. 2.8, 2.9